package com.league.zjxn.jetpack.vmodel

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.league.zjxn.base.BaseViewModel
import com.league.zjxn.entity.HomeDataResponse
import com.league.zjxn.entity.IndustryListResponse
import com.league.zjxn.entity.ProjectDataResponse
import com.league.zjxn.entity.RegionListResponse
import com.league.zjxn.jetpack.repository.HomeRepository
import com.league.zjxn.jetpack.repository.ProjectRepository
import com.module.lemlin.http.HttpResponseBody
import com.module.lemlin.http.SubscribeViewModel


class ProjectViewModel(application: Application) : BaseViewModel(application) {

    private val mProjectRepository: ProjectRepository = ProjectRepository()

    val projectDataLiveData = MutableLiveData<HttpResponseBody<ProjectDataResponse>>()
    fun projectList(
        province_id: String? = null,
        city_id: String? = null,
        title: String? = null) {
        setRxLifeScope(SubscribeViewModel(projectDataLiveData)) {
            mProjectRepository.projectList(province_id, city_id, title)
        }
    }

    val regionListLiveData = MutableLiveData<HttpResponseBody<RegionListResponse>>()
    fun userRegionList() {
        setRxLifeScope(SubscribeViewModel(regionListLiveData)) {
            mProjectRepository.userRegionList()
        }
    }


}